<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
        xmlns:f     = "http://xmlns.4suite.org/ext"
        xmlns:xsl   = "http://www.w3.org/1999/XSL/Transform"
        xmlns:rdf   = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:foaf  = "http://xmlns.com/foaf/0.1/"
        xmlns:v     = "http://www.w3.org/2006/vcard/ns#"
        xmlns:akamu = "tag:metacognitionllc.com,2012:AkamuXsltExtensions"
        extension-element-prefixes="akamu"
        version     = "1.0">
    <xsl:param name = "path" />
    <xsl:param name = "graph-uri" />
    <xsl:template match="/">
        <akamu:create-resource path="/patients/ptRec01.xml">
            <Patient name="Uche Ogbuji"/>
        </akamu:create-resource>
        <Answer>
            <akamu:sparql-query
                    datasetName="mysqlDataset"
                    targetGraph="http://example.com/patients/ptRec01">
                ASK { [] a foaf:Person; foaf:businessCard [ v:fn "Uche Ogbuji" ] }
            </akamu:sparql-query>
            <akamu:get-resource path="/patients/ptRec01.xml"/>
            <AfterChange>
                <akamu:update-resource path="/patients/ptRec01.xml">
                    <Patient name="Chimezie Ogbuji"/>
                </akamu:update-resource>
                <akamu:get-resource path="/patients/ptRec01.xml"/>
                <xsl:for-each select="akamu:get-resource('/patients/ptRec01.xml')/../*[@name = 'Chimezie Ogbuji']">
                    <FoundPatientViaExtensionFunction />
                </xsl:for-each>
            </AfterChange>
        </Answer>
    </xsl:template>
</xsl:stylesheet>